package UDF;


import ch.hsr.geohash.GeoHash;
import org.apache.hadoop.hive.ql.exec.UDF;

public class TOGeoHash extends UDF {
    public String evaluate(double latitude, double longitude, int numberOfCharacters){
        GeoHash geoHash = GeoHash.withCharacterPrecision( latitude,  longitude,  numberOfCharacters);
        return geoHash.toBase32();
    }

    public static void main(String[] args) {
        System.out.println(new TOGeoHash().evaluate(116.39564503787867,39.92998577808024,6));
    }
}
